package com.liugai.tool.encrypt;

import org.springframework.util.DigestUtils;

public class Encrypter {
    private static String md5Secret = "lgMd5";
    public static String md5(String str) {
        if (str == null) {
            return null;
        }
        return DigestUtils.md5DigestAsHex((str+md5Secret).getBytes());
    }

    public static String md5(String str, String secret) {
        if (str == null) {
            return null;
        }
        String secretMd5 = secret;
        if (secretMd5 == null) {
            secretMd5 = md5Secret;
        }
        return DigestUtils.md5DigestAsHex((str+secretMd5).getBytes());
    }



}
